package cn.hls.service.impl;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import cn.hls.dao.SiteDao;
import cn.hls.entity.Site;
import cn.hls.entity.vo.PageInfo;
import cn.hls.service.SiteService;

/**
 * @fileName: SiteServiceImpl.java
 * @package: cn.christ.service.impl
 * @Description: 会友业务逻辑接口实现类
 * @author: yinghui.zhang
 * @email: uuhui@163.com
 * @date: 2015-7-18
 */
@Service("siteService")
public class SiteServiceBean extends BaseServiceBean<Site> implements
		SiteService {
	@Resource(name = "siteDao")
	private SiteDao dao;

	
	@Override
	public boolean update(Site entity) throws Exception {
		Site tempEntity = dao.find(entity.getId());
		Date createTime = tempEntity.getCreateTime();
		Integer status=tempEntity.getStatus();
		Integer type=tempEntity.getType();
		BeanUtils.copyProperties(entity, tempEntity);
		tempEntity.setCreateTime(createTime);
		tempEntity.setStatus(status);
		tempEntity.setType(type);
		tempEntity.setUpdateTime(new Date());
		return super.update(tempEntity);
	}

	@Override
	public void delete(Object entityId) throws Exception {
		dao.delete(entityId);
	}

	@Override
	public PageInfo<Site> loadSiteInfo(Site entity,
			PageInfo<Site> page) throws Exception {
		return dao.loadSiteInfo(entity, page);
	}

	@Override
	public List<Site> loadSiteList(Site entity) throws Exception {
		return dao.loadSiteList(entity);
	}

	@Override
	public boolean exists(Site entity) throws Exception {
		return dao.exists(entity);
	}

}
